#include <stdio.h>
#include <pthread.h>

void* thread_main(void *arg);


int main(int argc, char *argv[]){

	pthread_t t_id;
	void *thr_ret;

	int thread_param=5;

	if(pthread_create(&t_id, NULL, thread_main, (void *)&thread_param)!=0){
	
		puts("ptread_create() error\n");
		return -1;
	}
	printf("thread id : %ds\n", t_id);
	
	pthread_join(t_id, &thr_ret);



	puts("end of main\n");
	return 0;


}

void* thread_main(void *arg){
	int i;
	int cnt = *((int*)arg);
	for (i=0;i<cnt ;i++ )
	{
		sleep(1);
		puts("running thread\n");
	}
	return NULL;
}

